package com.yeung.ssm.bean;

public enum EmployeeStatus {
    Busy(100, "忙碌"), Rest(200, "休息"), Offline(300, "待岗"), Holiday(400, "休假");

    private int code;
    private String msg;

    EmployeeStatus(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "EmployeeStatus{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }

    public static EmployeeStatus newInstance(int code) {
        switch (code) {
            case 100:
                return Busy;
            case 200:
                return Rest;
            case 300:
                return Offline;
            default:
                return Holiday;
        }
    }
}